/*
 * @Description: 数据项管理
 */
import zhreq from "@/api/axios";
// import zhreqtwo from "@/api/axios";
export default {
  /**
   * @description: 获取下拉选择所属数据项 *代表必填
   * @param {Number} ownershipId *
   */
  getalldataitemselect() {
    return zhreq.post('v3/iot/device/queryByCondition', {
      // companyMark: sessionStorage.getItem("organizationMark"),
      organizationNo: sessionStorage.getItem("organizationNo")
      // ownershipId: 1
    });
  },
  /**
   * @description: 获取表格数据
   * @param {Object}  *
   */
  getlist(params, partwo) {
    return zhreq.post('/v3/iot/deviceFacilityMapper/queryPageList' +
      '',
    {
      page: params.page,
      size: params.size,
      entity: {
        dataItemName: params.dataItemName,
        category: params.category,
        ...partwo
      }
    });
  },

  // 、、、、//////////////////////////////////////////////////////
  /**
   * @description: 批量查询物联单位
   * @param {Object}  *
   */
  getiotunitlist() {
    return zhreq.get('/iotUnit/queryList')
  },
  /**
   * @description: 获取气象站数据
   * @param {Object}  *
   */
  getrtulist() {
    return zhreq.get('/iot/rtu/queryMeteorologicalRtuList')
  },
  /**
   * @description: 通过获取数据项
   * @param {Object}  *
   */
  getrtudataitemlist(id) {
    return zhreq.get(`/iot/dataItem/queryByRtuId?rtuId= ${id}`)
  },

  getlisttwo(params) {
    return zhreq.post('/sensorFacilityMapper/queryPageList',
      {
        page: params.page,
        size: params.size,
        entity: {
          dataItemName: params.dataItemName,
          category: params.category,
          organizationNo: sessionStorage.getItem("parent") || sessionStorage.getItem("organizationNo")
        }
      });
  },
  /**
   * @description: 添加一条数据
   * @param {Object}  *
   */
  addlist(params) {
    return zhreq.post('/v3/iot/deviceFacilityMapper/add', params);
  },
  /**
   * @description: 批量删除
   * @param {Object}  *
   */
  dellist(params) {
    return zhreq.post('/v3/iot/deviceFacilityMapper/delList', {
      'deviceFacilityMapperIdList': params
    });
  },
  /**
   * @description: 修改
   * @param {Object}  *
   */
  editlist(params) {
    return zhreq.post('v3/iot/deviceFacilityMapper/edit', {
      ...params
    });
  }
};
